﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo9
{
    class Program
    {
        static void Main(string[] args)
        {
            // 定义好具有读写属性的类，实例化的时候可以如下方式进行初始化
            DigitBook db1 = new DigitBook()
            {
                Name="灌篮高手",
                Price= 398m,
                Url = "http://192.168.1.1/d"
            };

            DigitBook db2 = new DigitBook()
            {
                Name = "龙珠",
                Price = 498m,
                Url = "http://192.168.1.1/e"
            };

            DigitBook db3 = new DigitBook()
            {
                Name = "蜡笔小新",
                Price = 298m,
                Url = "http://192.168.1.1/f"
            };

            OldBook ob1 = new OldBook()
            {
                Name = "C#程序设计",
                Price = 100m,
                PublishDate = DateTime.Parse("2018-1-1"),
            };

            Console.WriteLine($"{db1.Name}的单价折后为{db1.CalDiscount()}");
            Console.WriteLine($"{db2.Name}的单价折后为{db2.CalDiscount()}");
            Console.WriteLine($"{db3.Name}的单价折后为{db3.CalDiscount()}");
            Console.WriteLine($"{ob1.Name}的单价折后为{ob1.CalDiscount()}");

            Console.ReadKey();
        }
    }
}
